//
//  ReturnGoodTableViewCell.m
//  GoShops
//
//  Created by zcj on 15-12-2.
//  Copyright (c) 2015年 郑朝军. All rights reserved.
//

#import "ReturnGoodTableViewCell.h"
#import "ReturnBtn.h"
#import "Grouble.h"
@interface ReturnGoodTableViewCell()
@property(nonatomic,weak)ReturnBtn * RetBtn;
@end

@implementation ReturnGoodTableViewCell
+ (instancetype)ReturnGoodTableViewCell:(UITableView *)tableView
{

    static NSString *ID = @"returngoodcell";
    ReturnGoodTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[ReturnGoodTableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
    }
    // 选中无颜色
   // cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return cell;
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.userInteractionEnabled = YES;
        CGFloat retBtnX = 10;
        CGFloat retBtnY = 0;
        CGFloat retBtnW = ScreenWidth * 0.5;
        CGFloat retBtnH = 40;
        CGRect retBtnRec = CGRectMake(retBtnX, retBtnY, retBtnW, retBtnH);
        
        ReturnBtn * retBtn = [[ReturnBtn alloc]initWithFrame:CGRectMake(retBtnX, retBtnY, retBtnW, retBtnH)];
        [retBtn addTarget:self action:@selector(BtnClick:) forControlEvents:UIControlEventTouchDown];
        
       
        [self addSubview:retBtn];
        //self.RetBtn = retBtn;
        
        CGFloat leftLableX = CGRectGetMaxX(retBtnRec) + retBtnX;
        CGFloat leftLableY = retBtnX;
        CGFloat leftLableW = ScreenWidth * 0.5;
        CGFloat leftLableH = 40;
        UILabel * leftLable  = [[UILabel alloc]initWithFrame:CGRectMake(leftLableX, leftLableY, leftLableW, leftLableH)];
        leftLable.text = @"已销22300";
        leftLable.textAlignment = NSTextAlignmentLeft;
        
        [self addSubview:leftLable];
        
    }
    return self;
}
// 点击按钮通知代理
- (void)BtnClick:(UIButton *)btn
{
    if ([self.delegate respondsToSelector:@selector(ReturnGoodTableViewCellBtnClick)]) {
        [self.delegate ReturnGoodTableViewCellBtnClick];
    }
}
- (void)awakeFromNib
{
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
